package com.firewolf.spring;

import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.firewolf.spring.dao.UserDao;

/**
 * 
 * @author lx
 *
 */
public class MainDriver {
	
	private ApplicationContext ctx = null;
	
	/**
	 * 初始化
	 */
	@Before
	public void init(){
		ctx = new ClassPathXmlApplicationContext("spring.xml");
	}
	
	@Test
	public void testJDBC(){
		UserDao dao = ctx.getBean(UserDao.class);
		dao.exeDDL();
	}
	
	@Test
	public void testJDBC2(){
		UserDao dao = ctx.getBean(UserDao.class);
		dao.saveUser();
	}
	@Test
	public void testNamedSql(){
		UserDao dao = ctx.getBean(UserDao.class);
		dao.namedSql();
	}
}                                                                                     
